# -*- coding: utf-8 -*-
import cv2
import numpy as np

# 读入原始图片
originalimg = cv2.imread("images/CSDN_NOISE.jpg", cv2.IMREAD_UNCHANGED)

# 定义核
kernel = np.ones((5, 5), np.uint8)

#腐蚀图片
erodeimg = cv2.erode(originalimg, kernel, iterations=2)

#膨胀图片
dilateimg = cv2.dilate(erodeimg,kernel,iterations=2)


cv2.imshow("Original", originalimg)
cv2.imshow("New1", dilateimg)

cv2.waitKey(0)

